-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() #143892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() #143892
Conversation
|
Hi, this PR fixes an internal correctness issue in socket.sendmsg(). |
|
No. It remains uaerfacing. In general, every bug fix should be announced if it can be seen only with pure python code and the public API |
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Thanks for guiding, I have added the news entry. |
|
I have made the requested changes; please review again. |
|
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
…nshu2282-cyber/cpython into fix-sendmsg-reentrant-cmsg
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the test on unmodified Python, it does crash as expected:
test_sendmsg_reentrant_ancillary_mutation (test.test_socket.GeneralModuleTests.test_sendmsg_reentrant_ancillary_mutation) ...
Fatal Python error: Segmentation fault
Co-authored-by: Victor Stinner <vstinner@python.org>
picnixz's review has been addressed.
|
"All required checks pass" failed with:
I'm not sure what's going on. Let me try to update this branch, maybe it will magically fix thei ssue? |
vstinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@picnixz: Do you want to double check this PR?
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Fix a crash in socket.sendmsg() caused by re-entrant mutation of ancillary data during argument parsing.
Hold a strong reference to each ancillary item while parsing to avoid use-after-free, and added a regression test.
socket.sendmsgancillary parser after re-entrant__index__clears the control list #143637